package com.entity;

// Generated 09.02.2014 20:16:29 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * WatchersEntity generated by hbm2java
 */
@Entity
@Table(name = "watchers", catalog = "jiraexcel")
public class WatchersEntity implements java.io.Serializable {

	private Integer idWatchers;
	private IssueEntity issueEntity;
	private Set<UserEntity> userEntities = new HashSet<UserEntity>(0);

	public WatchersEntity() {
	}

	public WatchersEntity(IssueEntity issueEntity) {
		this.issueEntity = issueEntity;
	}

	public WatchersEntity(IssueEntity issueEntity, Set<UserEntity> userEntities) {
		this.issueEntity = issueEntity;
		this.userEntities = userEntities;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_watchers", unique = true, nullable = false)
	public Integer getIdWatchers() {
		return this.idWatchers;
	}

	public void setIdWatchers(Integer idWatchers) {
		this.idWatchers = idWatchers;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "issue_id_issue", nullable = false)
	public IssueEntity getIssueEntity() {
		return this.issueEntity;
	}

	public void setIssueEntity(IssueEntity issueEntity) {
		this.issueEntity = issueEntity;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "watchers_has_user", catalog = "jiraexcel", joinColumns = { @JoinColumn(name = "watchers_id_watchers", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "user_id_user", nullable = false, updatable = false) })
	public Set<UserEntity> getUserEntities() {
		return this.userEntities;
	}

	public void setUserEntities(Set<UserEntity> userEntities) {
		this.userEntities = userEntities;
	}

}
